package com.group3.controller.adminController;

import com.group3.domain.LeaveDetail;
import com.group3.pojo.receive.LeaveReceive;
import com.group3.pojo.result.LeaveDetailResult;
import com.group3.service.ALeaveService;
import com.group3.utils.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

/**
 * ALeaveController
 *
 * @author HY
 * 2021/06/04 10:53
 **/


@Api(tags = "管理员接口")
@RestController
@RequestMapping("/admin/leave")
public class ALeaveController {

    @Resource
    private ALeaveService aLeaveService;

//    管理员查看请假
    @GetMapping(value = ""  )
    @ApiOperation(value = "管理员查看请假记录"  )
    public Result<List<LeaveDetail>> selectLeave(@Validated LeaveReceive leaveReceive){

//        return ResultUtil.success(leaveReceive.toString());
        return aLeaveService.selectLeave(leaveReceive);
    }
//    管理员查看请假详情
    @GetMapping(value = "/resource"  )
    @ApiOperation(value = "管理员查看请假详情记录"  )
    @ApiImplicitParam(name = "leaveId", value = "请假记录id",required = true,
            dataType = "int")
    public Result<LeaveDetailResult> showLeave(@Validated Integer leaveId){

//        return ResultUtil.success(leaveReceive.toString());
        return aLeaveService.showLeave(leaveId);
    }
    // 是否差一个接口：返回请假流程



}
